import { Telegraf, session, Context } from 'telegraf';
import Processor from './flows/Processor';
import { BotContext } from './types/Types';

const config = require('config');
const bot = new Telegraf<BotContext>(config.get("token"));
const processor: Processor = new Processor();

bot.use(session());

bot.start((ctx) => ctx.reply('Welcome to NoteBote!'))

bot.on('text', (ctx: Context) => {
    processor.text(ctx);    
});

bot.launch();

// module.exports.handler = async function (event: { body: string; }, context: any) {
//     const message = JSON.parse(event.body);
//     await bot.handleUpdate(message);
//     return {
//         statusCode: 200,
//         body: '',
//     };
// };